package br.com.universidade.util;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

@SuppressWarnings("deprecation")
public class HibernateUtil {

	private static SessionFactory factory;
	
	static{
		AnnotationConfiguration cfg = new AnnotationConfiguration();
		cfg.configure();
		factory = cfg.buildSessionFactory();

		//SchemaExport se = new SchemaExport(cfg);
		//se.create(true, true);
        }
	
	public Session getSession(){
		return factory.openSession();
	}
}
